#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @author：tester
# @file： initializeFunc.py
# datetime： 2021/7/19 9:57 
# ide： PyCharm
import hashlib
import time


from config import PROJECT_NAME, AC


def func_header():
    """
    更新header
    """
    SECRET = AC[PROJECT_NAME]['app_secret']
    TOKEN = AC[PROJECT_NAME]['app_token']
    timestamp = str(round(time.time() * 1000))
    signature = TOKEN.strip() + SECRET.strip() + timestamp.strip()
    md5 = hashlib.md5(signature.encode(encoding='utf-8')).hexdigest()
    header = {
        'x-qys-accesstoken': TOKEN,
        'x-qys-timestamp': timestamp,
        'x-qys-signature': md5
    }
    return header


